package org.ww.ware.dao;

import org.apache.ibatis.annotations.Param;
import org.ww.common.to.SkuWareStockTo;
import org.ww.ware.entity.WareSkuEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 商品库存
 * 
 * @author ww
 * @email ww@qq.com
 * @date 2024-01-05 15:13:15
 */
@Mapper
public interface WareSkuDao extends BaseMapper<WareSkuEntity> {

    void updatePruchaseUpdate(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("stock") Integer stock);

    List<SkuWareStockTo> selectSkuHasStock(@Param("skuIds") List<Long> skuIds);

    List<Long> listWareIdHasSkuStock(@Param("skuId") Long skuId);

    int lockSkuStock(@Param("skuId") Long skuId, @Param("wareId") Long wareId, @Param("num") Integer num);

    void unLockStock(@Param("wareId") Long wareId, @Param("skuId") Long skuId, @Param("skuNum") Integer skuNum);
}
